// JavaScript Document
var checkName = function () {
  document.getElementById('user').innerHTML = '';
  var name = eval(document.getElementById('username')).value;
  if (name.length > 20 || name.length < 1)
  document.getElementById('user').innerHTML = '用户名长度在1-20之间！';
};
var checkPassword = function () {
  document.getElementById('Pword').innerHTML = '';
  var name = eval(document.getElementById('password')).value;
  if (name.length > 12 || name.length < 6)
  document.getElementById('Pword').innerHTML = '密码长度在6-12之间！';
};
function sign() {
  //	  var type=document.getElementById("type").value;
  var username = document.getElementById('username').value;
  var password = document.getElementById('password').value;
  var bol;
  if (username == '')
  {
    return false;
  }
  if (password == '')
  {
    return false;
  }
  $.ajax({
    type: 'POST',
    //	    	 cache:false,
    url: 'DispatchAction?method=register',
    data: {"name": username ,"password": password},
    //	       async:false,
    //	       dataType:"html",
    success: function (msg) {
      if (msg == 'false')
      {
        alert('用户名或密码错误!');
        //	    		   bol=false;
      } 
      else if (msg == 'true') {
        window.location.href = 'jsp/in/main/important.jsp';
      } else alert('该用户已经登录');
    }
  });
  //	  return bol;
}
